<template>
  <div class="contentRight2">
    <div id="tools">

      <div class="height8"></div>
      <!-- 查询条件 -->
      <a-form layout="inline" style="text-align: left;padding: 0 10px;" :selfUpdate="true">

        <!--<a-form-item label="选择日期" class="marginBtm">-->
          <!--<a-config-provider :locale="localezh_CN">-->
            <!--<a-range-picker @change="onChangePicker" :locale="localezh_CN" :default-value="[startDate, endDate]" format="YYYY-MM-DD HH:mm:ss" :show-time="{ format: 'HH:mm:ss' }"/>-->
          <!--</a-config-provider>-->
        <!--</a-form-item>-->

        <a-form-item label="开始日期" class="marginBtm">
          <a-date-picker
            :allowClear="false"
            :disabledDate="disabledStartDate"
            v-model="startDate"
            placeholder="开始日期"
            show-time
            style="width: 180px;"
            @openChange="handleStartOpenChange"
          />
        </a-form-item>
        <a-form-item label="结束日期" class="marginBtm">
          <a-date-picker
            :allowClear="false"
            :disabledDate="disabledEndDate"
            placeholder="结束日期"
            show-time
            v-model="endDate"
            :open="endOpen"
            style="width: 180px;"
            @openChange="handleEndOpenChange"
          />
        </a-form-item>

        <a-form-item label="车辆类型" class="marginBtm">
          <a-dropdown class="min-width-110">
            <a-menu slot="overlay" @click="carTypeClick">
              <a-menu-item :key="item.typeId" v-for="item in carTypeList">{{item.name}}</a-menu-item>
            </a-menu>
            <a-button>
              <div class="query-conditions">
                {{ carTypeName }}
                <a-icon type="down"/>
              </div>
            </a-button>
          </a-dropdown>
        </a-form-item>

        <a-form-item label="基地" class="marginBtm">
          <a-dropdown class="min-width-110">
            <a-menu slot="overlay" @click="baseClick">
              <a-menu-item :key="item.id" v-for="item in baseList">{{item.name}}</a-menu-item>
            </a-menu>
            <a-button>
              <div class="query-conditions">
                {{ baseName }}
                <a-icon type="down"/>
              </div>
            </a-button>
          </a-dropdown>
        </a-form-item>

        <a-form-item label="区域" class="marginBtm">
          <a-dropdown class="min-width-140">
            <a-menu slot="overlay" @click="areaMenuClick">
              <a-menu-item :key="item.id" v-for="item in areaList">{{item.areaName}}</a-menu-item>
            </a-menu>
            <a-button>
              <div class="query-conditions">
                {{ areaName }}
                <a-icon type="down"/>
              </div>
            </a-button>
          </a-dropdown>
        </a-form-item>

        <a-form-item label="停车场" class="marginBtm">
          <a-dropdown class="min-width-200">
            <a-menu slot="overlay" @click="bdParkClick">
              <a-menu-item :key="item.bdParkId" v-for="item in bdParkList">{{item.bdParkName}}</a-menu-item>
            </a-menu>
            <a-button>
              <div class="query-conditions">
                {{ bdParkName }}
                <a-icon type="down"/>
              </div>
            </a-button>
          </a-dropdown>
        </a-form-item>
        <a-form-item label="道口方向" class="marginBtm">
          <!--99全部1出2进-->
          <a-dropdown class="min-width-110">
            <a-menu slot="overlay" @click="handleMenuClick">
              <a-menu-item :key="item.id" v-for="item in approvalStatus">{{item.name}}</a-menu-item>
            </a-menu>
            <a-button>
              <div class="query-conditions">
                {{ statusValue }}
                <a-icon type="down"/>
              </div>
            </a-button>
          </a-dropdown>
        </a-form-item>

        <a-form-item label="道口" class="marginBtm">
          <a-dropdown class="min-width-160">
            <a-menu slot="overlay" @click="roadCrossingClick">
              <a-menu-item :key="item.roadCrossingId" v-for="item in roadCrossingList">{{item.roadCrossingName}}</a-menu-item>
            </a-menu>
            <a-button>
              <div class="query-conditions">
                {{ roadCrossingName }}
                <a-icon type="down"/>
              </div>
            </a-button>
          </a-dropdown>
        </a-form-item>

        <a-form-item label="关键字" class="marginBtm">
          <a-input v-model="queryValue" allowClear placeholder="请输入工号/姓名/车牌"
                   @pressEnter="inquireStart"/>
        </a-form-item>

        <a-form-item class="marginBtm">
          <a-button type="primary" @click="inquireStart">
            查询
          </a-button>
        </a-form-item>

      </a-form>
      <a-divider style="margin: 5px 0"/>
      <div style="padding: 5px 10px 10px 10px;text-align: left;">
        <a-button type="primary" class="button-marin" @click="exportList">
          导出
        </a-button>
        <!--<a-button type="primary" class="button-marin" @click="addDilog">-->
        <!--新增-->
        <!--</a-button>-->
      </div>
    </div>

    <a-table
      class="tabled"
      bordered
      :fixed="true"
      size="small"
      :columns="columns"
      :row-key="record => record.xh"
      :data-source="tableData"
      :pagination="pagination"
      :loading="loading"
      :scroll="{ x:xWidth,y: yHeight }"
      :locale="localezh_CN"
      @change="handleTableChange"
    >
      <!--点击行选中行，点击单选按钮选中行；但是需要:row-key是唯一标示字段-->
      <!--:rowSelection="{type:'radio',selectedRowKeys:selectedRowKeys,fixed:true,onChange:onChange}"-->
      <!--:customRow="clickRow"-->

      <!--parkLx:  1蓝卡（不显示）  2捷顺（仅2时显示）-->
      <span slot="operate" slot-scope="text,data" v-if="data.parkLx == 2">
        <a @click="()=>seePhoto(data)">查看图片</a>
      </span>
    </a-table>

    <!--设备目录-->
    <a-modal
      v-model="photoVisible"
      title="查看图片"
      width="1100px"
      :destroyOnClose="true"
      :maskClosable="false"
      :keyboard="false">
      <template slot="footer">
        <a-button key="back" @click="handleCancel">
          关闭
        </a-button>
      </template>
      <a-spin :spinning="photoSpinning">
        <div style="width: 100%;height: 60vh;overflow: auto">
          <!--<img v-for="item in lookImg " :src="item" alt="" style="width: 320px;margin:0 20px 20px 0;object-fit: cover;">-->
          <p v-if="errorMessage != ''" style="text-align: center;font-size: 14px;margin-top: 20px;">{{errorMessage}}</p>
          <img :src="imgBase64" alt="" style="width: 100%;margin: 0;" v-else>
        </div>
      </a-spin>

    </a-modal>

    <!--导出加载中-->
    <customLoading :customVisible="spinning"></customLoading>

  </div>
</template>

<script>
  import {tableBoxHeight} from "@/api/communal";
  import reservationApi from "@/api/reservation";
  import carPresenceStatisticsApi from "@/api/visitorSystem/carPresenceStatistics";
  import localezh_CN from 'antd/lib/locale-provider/zh_CN';
  import dateUtil from "@/utils/dateUtils";
  import moment from "moment";
  import {ConfigProvider} from 'ant-design-vue';//引用
  import 'moment/locale/zh-cn';
  import cfg from '@/config/config'

  export default {
    components: {
      ConfigProvider
    },
    name: '',
    data() {
      return {
        localezh_CN,
        spinning: false,
        delayTime: 500,
        xWidth: "",
        yHeight: "",
        tableData: [],
        pagination: {
          pageSize: 30,
          current: 1,
          total: 0,
          showSizeChanger: true,
          // showQuickJumper: true,
          pageSizeOptions: ["20", "30", "50"],
          showTotal: (total) => `共 ${total} 条`, // 显示总数
          onShowSizeChange: (current, pageSize) => {
            // console.log("1111");
            this.pagination.current = 1;
            this.pagination.pageSize = pageSize;
          },
        },
        selectedRowKeys: [],
        loading: false,
        dateFormat: 'YYYY/MM/DD',
        startDate: "",
        endDate: "",
        endOpen: false,
        startDated: "",
        endDated: "",
        queryValue: "",  //查询值,访客名称，访客手机号
        columns: [],   //表格表头
        statusValue: "",  //状态名称
        statusId: 99,   //状态id，<!--99全部2出1进-->
        approvalStatus: [
          {name: "全部", id: 99},
          {name: "出口", id: 2},
          {name: "进口", id: 1},
        ],
        //车辆类型
        carTypeName: "全部",
        carTypeId: "",
        carTypeList: [],
        //基地
        baseName: "全部",
        baseId: "",
        isHaveArea: 0,   //是否有区域 1有 ， 0 没有
        baseList: [
          {name: "全部", id: ""}
        ],
        //区域列表
        areaName: "全部",    //区域名称
        areaId: "",   //99查全部，或者区域id
        areaList: [
          {areaName: "全部", id: ""},
        ],
        //停车场
        bdParkName: "全部",
        bdParkId:"",
        bdParkList:[
          {bdParkName:"全部",bdParkId:""}
        ],
        //出入口、道口
        roadCrossingName: "全部",
        roadCrossingId: 0,
        roadCrossingList: [
          {roadCrossingName: "全部", roadCrossingId: 0}
        ],
        // 查看图片
        photoVisible: false,
        photoSpinning: false,
        lookImg: [],
        imgBase64: "",
        errorMessage: ""
      }
    },
    beforeMount() {
      // carDatetime: "2020-11-15 10:11:43"
      // carInout: "进"
      // carName: "沪BDS391"
      // carSbidName: "一期出口左侧"
      // userLname: null
      // userNo: null
      this.columns = [
        {
          title: '序号',     //表头
          dataIndex: 'serialNumber',   //字段名称
          width: '50px',    //设列宽度
          fixed: "left",
          align: 'center',  //居中显示
          className: 'changeBack',   //重置覆盖背景色为浅灰色，否则是白色的
          customRender: (value, row, index) => `${(this.pagination.current - 1) * this.pagination.pageSize + index + 1}`  //设置动态序号
        },
        {
          title: '工号',
          dataIndex: 'userNo',
          width: '90px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '姓名',
          dataIndex: 'userLname',
          width: '90px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '车牌',
          dataIndex: 'carName',
          width: '100px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '方向',
          dataIndex: 'carInout',
          width: '70px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack',
        },
        {
          title: '时间',
          dataIndex: 'carDatetime',
          width: '150px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '车辆类型',
          dataIndex: 'lx',
          width: '100px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '基地',
          dataIndex: 'bdQy',
          width: '100px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '区域',
          dataIndex: 'bdAreaName',
          width: '120px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '停车场',
          dataIndex: 'bdParkName',
          width: '190px',
          align: 'center',
          ellipsis: true,
          className: 'changeBack'
        },
        {
          title: '道口',
          dataIndex: 'carSbidName',
          width: '150px',
          align: 'center',
          className: 'changeBack',
          ellipsis: true,   //此属性可以让单元格内容根据宽度自动省略
        },
        {
          title: '操作',
          dataIndex: 'operate',
          key: 'operate',
          width: '100px',
          scopedSlots: {customRender: 'operate'},
          align: "center",
          className: "changeBack"
        },
        {
          title: '',
          dataIndex: '',
          width: 'auto',
          align: 'center',
          className: 'changeBack'
        },

      ];
      // this.tableData =[
      //   {userNo:12213,userLname:"张四",carName:"F12312",carSbidName:"2131",carInout:"进",visitDateBegin:"",carDatetime:""}
      // ]
      this.startDate = moment().startOf('month');
      this.endDate = moment().endOf('month');
      this.startDated = moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
      this.endDated = moment(this.endDate).format('YYYY-MM-DD HH:mm:ss');
    },
    async mounted() {
      // console.log(tableBoxHeight());
      this.xWidth = this.getTableWidth();
      this.statusValue = this.approvalStatus[0].name;
      this.statusId = this.approvalStatus[0].id;
      this.getDtAllcarsqLxs();    // 获取车辆类型
      this.getSmartPositionBdQys();   //获取基地
      await this.inquireStart();
      this.$nextTick(()=>{
        this.yHeight = tableBoxHeight() + 3  + "px";
        let minHeight = document.getElementsByClassName("ant-table");
        minHeight[0].style.minHeight = tableBoxHeight() + 40 + "px";
      });
    },
    methods: {
      // 计算表格宽度
      getTableWidth() {
        let totals = null;
        var el;
        for (el of this.columns) {
          totals += parseInt(el.width);
        }
        return totals + 100 + "px"
      },
      // 选择日期
      onChangePicker(date, dateString) {
        // console.log(date, dateString);
        this.startDated = dateString[0];
        this.endDated = dateString[1];
      },
      //日期控件需要的方法
      disabledStartDate(startDate) {
        const endDate = this.endDate;
        if (!startDate || !endDate) {
          return false;
        }
        return startDate.valueOf() > endDate.valueOf();
      },
      disabledEndDate(endDate) {
        const startDate = this.startDate;
        if (!endDate || !startDate) {
          return false;
        }
        return startDate.valueOf() >= endDate.valueOf();
      },
      handleStartOpenChange(open) {
        // if (!open) {
        //   this.endOpen = true;
        // }
      },
      handleEndOpenChange(open) {
        this.endOpen = open;
      },

      // 导出列表
      async exportList() {
        this.startDated = this.startDate == "" || this.startDate == null ? "" : moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
        this.endDated = this.endDated == "" || this.endDated == null ? "" : moment(this.endDate).format('YYYY-MM-DD HH:mm:ss');
        if (this.startDated == "") {
          this.$message.warning("开始日期不能为空");
          return
        }
        if (this.endDated == "") {
          this.$message.warning("结束日期不能为空");
          return
        }

        this.spinning = true;
        let param = {
          current: this.pagination.current,
          pageSize: this.pagination.pageSize,
          startDate: this.startDated,
          endDate: this.endDated,
          carInout: this.statusId,
          serchTxt: this.queryValue,
          lx: this.carTypeId,
          bdQy: this.baseId,
          bdAreaId: this.areaId,
          bdParkId: this.bdParkId,
          roadCrossing: this.roadCrossingId,    //入口
        };
        let jsonIn = encodeURI(encodeURI(JSON.stringify(param)));
        await window.open(cfg.apiUrl + 'api/visitor/exportSmartCartempList?jsonIn=' + jsonIn, "_self");
        setTimeout(()=>{
          this.spinning = false;
        },1000)

      },
      // 开始查询
      inquireStart() {
        this.pagination.current = 1;
        this.startDated = this.startDate == "" || this.startDate == null ? "" : moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
        this.endDated = this.endDated == "" || this.endDated == null ? "" : moment(this.endDate).format('YYYY-MM-DD HH:mm:ss');
        let param = {
          current: this.pagination.current,
          pageSize: this.pagination.pageSize,
          startDate: this.startDated,
          endDate: this.endDated,
          carInout: this.statusId,   //carInout
          serchTxt: this.queryValue,
          lx: this.carTypeId,
          bdQy: this.baseId,
          bdAreaId: this.areaId,
          bdParkId: this.bdParkId,
          roadCrossing: this.roadCrossingId,    //入口
        };
        // console.log(param);
        this.fetch(param);
      },
      // 切换方向
      handleMenuClick(e) {
        // console.log(e);
        console.log(this.baseId);
        console.log(this.bdParkId);
        this.approvalStatus.filter(el => {
          if (el.id == e.key) {
            // console.log(el);
            this.statusValue = el.name;
            this.statusId = el.id
          }
          if(this.baseId !== "" || this.bdParkId !== ""){
            this.roadCrossingName = "全部";
            this.roadCrossingId = 0;
            this.roadCrossingList = [{roadCrossingName: "全部", roadCrossingId: 0}];
            this.getRoadCrossInfoList();
          }
        });
        // console.log(this.statusValue,this.statusId);
      },
      // 车辆类型
      carTypeClick(e) {
        // console.log(e);
        this.carTypeList.filter(el => {
          if (el.typeId == e.key) {
            // console.log(el);
            this.carTypeName = el.name;
            this.carTypeId = el.typeId
          }
        });
        // console.log(this.statusValue,this.statusId);
      },
      // 切换基地，选择基地
      baseClick(e) {
        // console.log(e);
        let nowSelect;
        this.baseList.filter(el => {
          if (el.id == e.key) {
            this.baseName = el.name;
            this.baseId = el.id;
            nowSelect = el
          }
        });
        console.log(nowSelect);
        this.areaName = "全部";
        this.areaId = "";
        this.areaList = [{areaName: "全部", id: ""}],
        this.bdParkName = "全部";
        this.bdParkId = "";
        this.bdParkList = [{bdParkName:"全部",bdParkId:""}];
        this.roadCrossingName = "全部";
        this.roadCrossingId = 0;
        this.roadCrossingList = [{roadCrossingName: "全部", roadCrossingId: 0}];
        if (e.key != "") {
          this.getCarParkList(); // 获取停车场
          this.getRoadCrossInfoList();// 获取入口
        }
        if (nowSelect.isHaveArea == 1){
          this.getAreaList()
        }
      },
      // 切换区域，选择区域
      areaMenuClick(e) {
        // console.log(e);
        this.areaList.filter(el => {
          if (el.id == e.key) {
            // console.log(el);
            this.areaName = el.areaName;
            this.areaId = el.id;

            this.bdParkName = "全部";
            this.bdParkId = "";
            this.bdParkList = [{bdParkName:"全部",bdParkId:""}];
            this.roadCrossingName = "全部";
            this.roadCrossingId = 0;
            this.roadCrossingList = [{roadCrossingName: "全部", roadCrossingId: 0}];
          }
        });
        if (e.key != "" || this.baseId != ""){
          this.getCarParkList(); // 获取停车场
          this.getRoadCrossInfoList();// 获取入口
        }
      },
      bdParkClick(e) {
        // console.log(e);
        this.bdParkList.filter(el => {
          if (el.bdParkId == e.key) {
            this.bdParkName = el.bdParkName;
            this.bdParkId = el.bdParkId;
          }
        });
        this.roadCrossingName = "全部";
        this.roadCrossingId = 0;
        this.roadCrossingList = [{roadCrossingName: "全部", roadCrossingId: 0}];
        if (e.key != "" || this.baseId != "") {
          this.getRoadCrossInfoList(); // 获取入口
        }
      },
      // 切换入口
      roadCrossingClick(e) {
        this.roadCrossingList.filter(el => {
          if (el.roadCrossingId == e.key) {
            this.roadCrossingName = el.roadCrossingName;
            this.roadCrossingId = el.roadCrossingId
          }
        });
      },
      // 点击行
      clickRow(record) {
        return {
          on: {
            click: () => {
              // console.log(record)
              let keys = [];
              keys.push(record.orderId);
              this.selectedRowKeys = keys;
            }
          }
        }
      },
      handleCancel() {
        this.photoVisible = false
      },
      seePhoto(row) {
        // console.log(row);
        this.lookImg = [];
        this.errorMessage = "";
        this.imgBase64 = "data:image/jpg;base64,";
        this.photoSpinning = true;
        this.getPhotoList(row.parkInoutPhoto);
        this.photoVisible = true;
      },
      // 获取图片
      async getPhotoList(str) {
        let resp = await reservationApi.getBdParkInOutPhoto(str);
        // console.log(resp.data);
        if (resp.data.success) {
          // this.lookImg = resp.data.result;
          if (resp.data.result.resultCode == 0){
            this.imgBase64 += resp.data.result.dataItems[0].image;
          } else if(resp.data.result.resultCode == 302){
            this.imgBase64 = "";
            this.errorMessage = resp.data.result.message;
          }
          this.photoSpinning = false;
        } else {
          this.photoSpinning = false;
          this.$message.error(resp.data.message);
        }
      },
      // 表格切换分页
      handleTableChange(pagination, filters, sorter) {
        this.startDated = this.startDate == "" || this.startDate == null ? "" : moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
        this.endDated = this.endDated == "" || this.endDated == null ? "" : moment(this.endDate).format('YYYY-MM-DD HH:mm:ss');
        // console.log(pagination);
        const pager = {...this.pagination};
        pager.current = pagination.current;
        this.pagination = pager;
        this.fetch({
          pageSize: pagination.pageSize,
          current: pagination.current,
          startDate: this.startDated,
          endDate: this.endDated,
          carInout: this.statusId,
          serchTxt: this.queryValue,
          lx: this.carTypeId,
          bdQy: this.baseId,
          bdAreaId: this.areaId,
          bdParkId: this.bdParkId,
          roadCrossing: this.roadCrossingId,    //入口
          sortField: sorter.field,
          sortOrder: sorter.order,
          ...filters,
        });
      },

      onChange(selectedRowKeys, selectedRows) {
        // console.log(selectedRowKeys, selectedRows);
        this.selectedRowKeys = selectedRowKeys;
      },
      // 请求表格数据--测试用
      async fetch(params) {
        this.loading = true;
        let resp = await reservationApi.findSmartCartempList(params);
        // console.log(resp.data);
        if (resp.data.success) {
          // console.log("111");
          this.loading = false;
          this.pagination.total = resp.data.result.total;
          this.tableData = resp.data.result.records;

        } else {
          // console.log("222");
          this.loading = false;
          this.$message.error(resp.data.message);
        }

        // 测试
        // setTimeout(() => {
        //   this.tableData=[
        //     {serialNumber:"0",oddNumber:"14",visitName:"王晓明",visitCompony:"上海步达",visitTel:"13345674568",vistorCertNumber:"410526194601114235",userLname:"冯伟",userTelephone:"17612345678",visitDateBegin:"2020-10-10 08:00:00",visitDateEnd:"2020-10-10 17:30:00",entourage:"主访客",approvalStatus:"已通过"},
        //     {serialNumber:"0",oddNumber:"14",visitName:"王晓明",visitCompony:"上海步达",visitTel:"13345674568",vistorCertNumber:"410526194601114235",userLname:"冯伟",userTelephone:"17612345678",visitDateBegin:"2020-10-10 08:00:00",visitDateEnd:"2020-10-10 17:30:00",entourage:"主访客",approvalStatus:"已通过"},
        //   ];
        // this.tableData=this.tableData.map((el,i)=>{
        //    el.serialNumber = i + 1;
        //    return el
        // });
        // console.log(this.tableData);
        //   this.loading = false;
        // }, 2000);
      },

      // 车辆类型
      async getDtAllcarsqLxs() {
        let res = await reservationApi.getDtAllcarsqLxs()
        if (res.data.success) {
          this.carTypeList = [{name: "全部", typeId: ""}];
          this.carTypeList = [...this.carTypeList, ...res.data.result];
        } else {
          this.$message.error(res.data.message);
        }
      },

      // 获取基地
      async getSmartPositionBdQys() {
        let res = await reservationApi.getBdSysItemList({typeId: 200});
        if (res.data.success) {
          this.baseList = [...this.baseList, ...res.data.result];
        } else {
          this.$message.error(res.data.message);
        }
      },
      // 获取区域
      async getAreaList() {
        let res = await reservationApi.getBdVisitAreaListByRoleNew({typeId: this.baseId})
        // console.log(res.data);
        if (res.data.success) {
          this.areaList = [{areaName: "全部", id: ""}];
          this.areaList = [...this.areaList, ...res.data.result];
        } else {
          this.$message.error(res.data.message);
        }
      },
      // 根据基地获取停车场
      async getCarParkList() {
        let res = await reservationApi.getCarParkDate({
          bdStation: this.baseId,
          bdAreaId: this.areaId
        });
        console.log(res.data);
        if (res.data.success) {
          this.bdParkList = [{bdParkName:"全部",bdParkId:""}];
          this.bdParkList = [...this.bdParkList, ...res.data.result];
        } else {
          this.$message.error(res.data.message);
        }
      },
      // 根据基地获取入口、道口
      async getRoadCrossInfoList() {
        let res = await carPresenceStatisticsApi.getRoadCrossInfoList({
          fx: this.statusId,
          bdStation: this.baseId,
          bdAreaId: this.areaId,
          bdParkId: this.bdParkId   //停车场id
        });
        if (res.data.success) {
          if (res.data.success) {
            this.roadCrossingList = [{roadCrossingName: "全部", roadCrossingId: 0}];
            if (res.data.result && res.data.result.length > 0) {
              res.data.result.forEach(el => {
                this.roadCrossingList.push({
                  roadCrossingName: el.parkName,
                  roadCrossingId: el.parkSerial
                })
              })
            }
          }
          // this.roadCrossingList = [...this.roadCrossingList, ...res.data.result];
        } else {
          this.$message.error(res.data.message);
        }
      },

    },
  }
</script>

<style scoped>

</style>

